import React, { Suspense } from 'react'
import { useRoutes } from 'react-router-dom'
const Home = React.lazy(() => import('../views/home'))
const Login = React.lazy(() => import('../views/login'))

const ROUTER_LIST = [{
  path: '/',
  element: <Home></Home>
}, {
  path: '/login',
  element: <Login></Login>
}]


const RouterView = () => useRoutes(ROUTER_LIST);
const Router = () => {
  return (
    <Suspense fallback={<div>路由加载中...</div>}>
      <RouterView></RouterView>
    </Suspense>
  )
}

export default Router